package com.alibaba.citrus.cr.unified.inventory.facade.service;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

import com.alibaba.cz.base.model.store.enums.StoreEnum;
import com.alibaba.lattice2.epoch.sdk.model.Result;

import com.epoch.app.crunifiedinventory.model.dto.WarehouseCargozoneSearchRequest;
import com.epoch.app.crunifiedinventory.model.dto.WarehouseCargozoneSearchResponse;
import com.epoch.app.crunifiedinventory.model.enums.StoreTypeEnum;
import com.epoch.app.crunifiedinventory.warehousecargozone.dto.ConvertStoreTypeRequest;
import com.epoch.app.crunifiedinventory.warehousecargozone.service.WarehouseCargozoneService;
import org.springframework.stereotype.Component;

/**
 * @author Chen.mu
 * @date 2022/10/8
 */
@Component
public class WarehousecargozoneServiceImpl implements WarehouseCargozoneService {

    @Override
    public Result<String> convertStoreType(ConvertStoreTypeRequest convertStoreTypeRequest) {
        StoreTypeEnum typeEnum=  Arrays.stream(StoreTypeEnum.values()).filter(source -> Objects.equals(convertStoreTypeRequest.getStoretype(), source.getValue())).findFirst().orElse(null);
        if(typeEnum!=null){
            return Result.success(typeEnum.getLabel());
        }
        return Result.success("");
    }


    @Override
    public Result<List<WarehouseCargozoneSearchResponse>> search(
        WarehouseCargozoneSearchRequest warehouseCargozoneSearchRequest) {
        return WarehouseCargozoneService.super.search(warehouseCargozoneSearchRequest);
    }
}
